################################
#     John Henderson
#     Gerrymandering Incumbency 
#	(with Brian Hamel and Aaron Goldzimer)
#	January 1, 2018
#
################################ 

####################################
# replication code:
####################################

- analysisSTFun.R :: basic function that analyzes each state plan data to produce moments that are used in plotting functions

- sims2000.R
- sims2010.R :: basic functions that analyzes each simulated plan data to produce moments that are used in plotting functions

:: plotting functions 
- these are organized as ad = assembly district, sd = state senate, cd = congressional district

:: :: counterfactual proposal plot functions
  -cflip.R 	= # of seats that are within a small flip margin
  -counter.R 	= baseline average incumbent win margin plot  -flipprob.R	= plot using estimate flip probabilities 
  -partisan.R	= proportion of R held seats under the plan  -plan.R	= summary and t-test like statistics under the plans
  -figure1b.R	= combined simulation + counterfactual plot for cd 2010  -figure1c.R	= counterfactual plot for ad 2010  -figure1d.R	= counterfactual plot for sd 2010

:: :: simulation plot functions
  -flip.R	= plot using estimate flip probabilities   -vert.R	= baseline average incumbent win margin plot
  -sims.R	= summary and t-test like statistics under the plans
  -figure1a.R	= simulation plot for cd 2010
####################################
# replication data: mode of redistricting
#  redist_authority.csv & redist_authority.R
####################################

These data contain details on the mode of redistricting at the congressional and statehouse levels for states in 2000 and 2010. Code is also available to produce histograms plots (not included in final manuscript). 

These data were compiled, for the most part, using information put together by Justin Levitt in his book and website: Levitt, Justin. 2010. A Citizen's Guide to Redistricting. New York: Brennan Center, available at http://redistricting.lls.edu. Occasionally, we directly referred to the state statutes to clarify ambiguous cases.

redist_authority.R is a plotting function to produce plots from these data.


####################################
# replication data: 2010 alternative plans 
#  plans2010.zipped
####################################

These data contain the 1627 maps from 15 states taken from official sources online. These data objects are organized by state_chamber_dists_lists.Rdata. Chamber codes are AD = assembly district, SD = state senate, CD = congressional district. Each data object is a list, with the items in the list being a counterfactual map produced for the state, made up of districts. The data for proposed districts for each map contain the 2008 presidential democratic and republican vote shares (or party registration) produced by  merging either map shapefiles or block conversion files with voter data from the states' voting districts (VTDs). 

The data is contained in the file plans2010.zipped, which is a .zip file. You should unzip first (e.g., change the file extension to .zip) using any standard unarchiver software.

Original map shapefiles and block conversion files can be found here: http://dx.doi.org/10.7910/DVN/O62OHM; http://www.jahenderson.com/research/data. Code to produce each state_chamber_dists_lists.Rdata file from original maps can be found in the uploaded file full.zipped. Similar as above, full.zipped can be unzipped using any standard unarchiver software. 
 

####################################
# replication data: 2000 simulations
#  sims2000.zipped
####################################

These data originate from Chen, Jowei and Jonathan Rodden. 2013. "Unintentional Gerrymandering: Political Geography and Electoral Bias in Legislatures." Quarterly Journal of Political Science 8(3): 239–269.

The simulation data can be downloaded here: http://www-personal.umich.edu/~jowei/UnintentionalGerrymandering/. Proper citation should be given to Chen and Rodden (2013).

The data is contained in the file sims2000.zipped, which is a .zip file. You should unzip first (e.g., change the file extension to .zip) using any standard unarchiver software.


####################################
# replication data: 2010 simulations
#  sims2010.zipped
####################################

These data originate from Chen, Jowei and David Cottrell. 2016. "Evaluating Partisan Gains from Congressional Gerrymandering: Using Computer Simulations to Estimate the Effect of Gerrymandering in the U.S. House." Electoral Studies 44(2): 329–340.

The simulation data can be downloaded here: http://www-personal.umich.edu/~jowei/gerrymandering/. Proper citation should be given to Chen and Cottrell (2016).

The data is contained in the file sims2010.zipped, which is a .zip file. You should unzip first (e.g., change the file extension to .zip) using any standard unarchiver software.


####################################
# replication data: state swing margins
#  stateSwings.Rdata
####################################

These data contain the maximum and minimum average party vote shares across congressional districts for each state, taken between 2002 and 2010. These data are used to compute an alternative measure of competition that is presented in auxiliary analysis in the Appendix. This analysis is aimed at addressing the concern that using an average incumbent win margin for redistricting plans may under- or over-estimate competitiveness relative to other measures.

For instance, a standard approach to measure competitiveness is to set some vote margin threshold (e.g., 2.5 percentage points), and count the number of seats that were decided by a margin smaller than that threshold. However, some states and districts differ in their electoral volatility, so that a fixed threshold may not capture competitiveness appropriately everywhere. Instead, one alternative (non-parametric) approach sets the threshold for a state as the maximum possible (observed) vote swing its districts experienced over a five election-year history. This measure then captures the largest possible vote loss an incumbent (on average) might expect to face in a particular state and redistricting cycle.

These maximum and minimum values are computed by averaging the vote returns for both parties over each state's districts for every year within a redistricting cycle, here 2002 to 2010. The maximum swing is calculated as the absolute difference between the maximum and minimum average Republican margin, defined as maxdifR_j, and the absolute difference between the maximum and minimum average Democratic margin, denoted maxdif_j, for each j state. The competition threshold for each state then is the average of these two average differences, or 1/2*(maxdifR_j+maxdifD_j).

stateSwings.R is exampled code for how these data are produced.


####################################
# replication data: state vote data
#  voteData.Rdata
####################################

These are vote data compiled from CQ Elections. These data are used to estimate a model of seat switch probabilities (the probability an incumbent loses) given the prior margin of victory in a district. This latter model is used as an alternative measure of competitiveness in supplemental analysis presented in the Appendix.

presVote.R is example code for how these data are produced.

# end